feat: add prisma SQL migration for job-run internal flag backfill#564
feat: add prisma SQL migration for job-run internal flag backfill#564hmacr wants to merge 2 commits into
Conversation
|
| import chunk from "lodash.chunk"; | ||
|
|
||
| const MIGRATION_NAME = "2023-10-05-SetJobRunInternalFlag"; | ||
| const JOB_CHUNK_SIZE = 100; |
There was a problem hiding this comment.
What should be the ideal chunk size?
|
I like the idea of doing the backfilling separately, but I think we should try do the backfill in SQL using Prisma migrations. Something like: UPDATE "JobRun"
SET "internal" = "Job"."internal"
FROM "Job"
WHERE "JobRun"."jobId" = "Job"."id"; |
|
Ah ok. I was worried that a large update would reduce the DB throughput for other processes, so wrote a backfill script. I'll update the PR with the necessary SQL. |
bb970f1 to
8dba22a
Compare
|
I've removed the backfill script and added the SQL to update the job-run internal flag. The migration SQL worked as expected on local. |
|
Closing since this code is moved to #563 |
Closes #557
This builds on top of #563 and should ideally be merged after #563 goes live.
The intention is to separate the schema and API change from the backfill script. This way, the jobs & job runs that get created during the backfill execution can still have the correct
internalflags set (the API takes care of it).✅ Checklist
Testing
true.Changelog
internalflag for pastJobRunentries.💯